//
//  YxrConfirmView.swift
//  YXRSmartDeviceDemo
//
//  Created by run on 2024/7/1.
//

import SwiftUI

struct YxrConfirmView: View {
    let title: String
    let action: () -> Void

    init(title: String = "确认", action: @escaping () -> Void) {
        self.title = title
        self.action = action
    }

    var body: some View {
        Button(
            action: {
                MainApp.keyWindow?.endEditing(true)
                action()
            },
            label: {
                Text(title)
                    .foregroundColor(.white)
                    .padding()
                    .frame(width: 300, height: 49, alignment: .center)
                    .background(Color.accentColor)
                    .cornerRadius(10)
            }
        )
    }
}
